<html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:p="http://primefaces.org/ui">
<h:head>
	<title>广告积分墙管理</title>
	<link href="../../css/component.css" rel="stylesheet" type="text/css" />
</h:head>

<ui:param name="bean" value="#{advWarningAction}" />
<h:body>
	<h:form id="fsearch">
		<p:commandButton value="查询" action="#{bean.search()}" update=":data" ajax="false" />
		|
		<p:commandButton value="上传" type="button" onclick="PF('dlg1').show();" />
	</h:form>
	<br />	

	<!-- 展示所有配置数据 -->
	<p:outputLabel value="已有配置："></p:outputLabel>
	<h:form id="flist">
		<p:messages id="messages" showDetail="true" life="10000"/>	
		<p:dataTable id="dlist" var="config" value="#{bean.datas}" resizableColumns="true" scrollable="true" paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown} {Exporters}"  paginator="true" rows="12">
			<f:facet name="{Exporters}">
	        	<h:commandLink styleClass="exporter">
			        <p:graphicImage url="/resources/images/excel.png" height="25px"/>
			        <p:dataExporter type="xls" target="dlist" fileName="advCostData-#{pageHelper.getNewDateDetailStr()}"/>
			    </h:commandLink>
		    </f:facet>
			<p:column headerText="mac" style="text-align:center" width="10%">
				<h:outputText value="#{config.mac}" />
			</p:column>
			<p:column headerText="分类" style="text-align:center" width="10%">
				<p:inputText value="#{config.kindtype}" styleClass="inputText"/>
			</p:column>
			<p:column headerText="来源" style="text-align:center" width="15%">
				<p:inputText value="#{config.source}" styleClass="inputText"/>
			</p:column>
		</p:dataTable>
	</h:form>
	
	<p:dialog header="文件上传" widgetVar="dlg1" modal="true" height="500" width="100%" position="300px">
    	<h:form enctype="multipart/form-data">
    		<h3>说明</h3>
    		<span style="color:red">1.上传的文件必须为Excel文件；</span><br />
    		<span style="color:red">2.文件内容不能有表头，必须直接是数据；</span><br />
    		<span style="color:red">3.数据共分为3列：MAC、分类、来源</span><br />
			<p:separator />
    	
    		<h3>上传</h3>
    		<p:fileUpload fileUploadListener="#{bean.upload}" mode="advanced" allowTypes="/(\.|\/)(xls|xlsx|xlsm)$/" description="选择文件" label="选择" uploadLabel="上传" cancelLabel="取消" validatorMessage="格式错误." dragDropSupport="true" multiple="true" disabled="false"/>
	   		<p:separator />
	   		<h3>操作</h3>
	    	<p:commandButton value="生效" ajax="false" actionListener="#{bean.parseExcel}" />
	   	</h:form>
	</p:dialog>
</h:body>
</html>
